// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const {ccclass, property} = cc._decorator;

@ccclass
export default class stabMediator extends cc.Component {

    @property()
    canClick = false;

    protected onLoad(): void {
        if(this.canClick){
            this.node.on("touchstart",this.TouchStart,this);
        }
    }

    TouchStart(event){
        this.node.removeComponent(cc.WeldJoint);
    }

    longStabAction(){
        cc.tween(this.node).by(0.8,{
            position : cc.v2(0,-cc.winSize.height)
        }).start();
    }
}
